Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mysqld_exporter to v0.16.0 #1643

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

cristiangreco
Copy link
Contributor

PR Description

From grafana/mysqld_exporter branch refactor_collector, including changes in prometheus/mysqld_exporter#774.

Which issue(s) this PR fixes

n.a.

Notes to the Reviewer

n.a.

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • Config converters updated

@cristiangreco cristiangreco force-pushed the cristian/mysqld-exporter-upd branch 5 times, most recently from 152acc0 to b7b1fb2 Compare September 10, 2024 15:36
@cristiangreco cristiangreco force-pushed the cristian/mysqld-exporter-upd branch 2 times, most recently from 043860e to 0f466b4 Compare September 11, 2024 15:25
@cristiangreco cristiangreco marked this pull request as ready for review September 11, 2024 15:43
@cristiangreco cristiangreco requested a review from a team as a code owner September 11, 2024 15:43
@cristiangreco cristiangreco marked this pull request as draft September 11, 2024 15:43
Copy link
Contributor

This PR has not had any activity in the past 30 days, so the needs-attention label has been added to it.
If you do not have enough time to follow up on this PR or you think it's no longer relevant, consider closing it.
The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your PR will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity.
Thank you for your contributions!

@cristiangreco cristiangreco force-pushed the cristian/mysqld-exporter-upd branch 4 times, most recently from 9697e59 to bb8e29b Compare November 7, 2024 13:32
go.mod Outdated
@@ -161,7 +161,7 @@ require (
github.com/prometheus/common/sigv4 v0.1.0
github.com/prometheus/consul_exporter v0.8.0
github.com/prometheus/memcached_exporter v0.13.0
github.com/prometheus/mysqld_exporter v0.14.0
github.com/prometheus/mysqld_exporter v0.15.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any new config options that need to be exposed since it's a minor version, it can have new features?

From grafana/mysqld_exporter branch `refactor_collector`, including
changes in prometheus/mysqld_exporter#774.
@@ -122,7 +123,7 @@ func New(log log.Logger, c *Config) (integrations.Integration, error) {
}

scrapers := GetScrapers(c)
exporter := collector.New(context.Background(), string(dsn), scrapers, log, collector.Config{
exporter := collector.New(context.Background(), string(dsn), scrapers, slog.Default(), collector.Config{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thampiotr New here now requires an slog.Logger, is there any adapter in the Alloy codebase?

@cristiangreco cristiangreco changed the title Update mysqld_exporter to v0.15.1 Update mysqld_exporter to v0.16.0 Nov 11, 2024
@@ -122,7 +124,8 @@ func New(log log.Logger, c *Config) (integrations.Integration, error) {
}

scrapers := GetScrapers(c)
exporter := collector.New(context.Background(), string(dsn), scrapers, log, collector.Config{
logger := slog.New(slogadapter.GoKitHandler{Logger: log, Group: ""})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you could just cast the logger into our internal logger type log.(*logging.Logger) and then call the Handler() function to build the slog logger: slog.New(l.Handler())

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case, the slogadapter would not be needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried that:

panic: interface conversion: log.Logger is *log.context, not *logging.Logger

Unfortunately it seems it's a go-kit logger rather than the internal logging.Logger.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we could swap the go-kit logger for the internal logging.Logger that would indeed be much easier. I'm not sure how much work is that though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@wildum wildum Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is similar to the problem that @dehaansa encountered in this support bundle PR
There are a few options:

  • use the adapter that you made
  • implement log.With in the logging.Logger to pass the logging.logger instead of the go-kit logger
  • pass a slog logger instead of a gokit logger

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stole the adapter in this PR from @aknuds1 's work at https://github.com/grafana/mimir/pull/9844/files#diff-36917e58779c0933db5147cf951d9c445a912ba808cf35c32ac951063b91f93f

Option 2 or option 3 that you mentioned above are more appealing though, as we would avoid relying on an adapter forever.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah the thing is that we want to migrate the code base to use slog everywhere. The idea behind the slogadapter that we already have is to be able to use slog in the areas where go-kit is still needed. It feels like the adapter that this PR is adding is going the wrong way, it's going from slog to go-kit and back to slog.
This is out of the scope of this PR so if that's ok I would suggest to pause it for now and that we find a better solution to pass the slog logger properly to the components that can use it directly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when do you need the update of the exporter in Alloy?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants